package cn.yxr.bean;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.HashMap;
import java.util.Map;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Msg {

    private Integer code;
    private String info;
    private Map<String, Object> returnData = new HashMap<String, Object>();
    //成功
    public static Msg success() {
        Msg result = new Msg();
        result.setCode(200);
        result.setInfo("操作成功!!!");
        return result;
    }
    //失败
    public static Msg fail() {
        Msg result = new Msg();
        result.setCode(100);
        result.setInfo("操作失败!!!");
        return result;
    }
    public Msg add(String key, Object value) {
        this.returnData.put(key, value);
        return this;
    }
}
